package com.eh.template.duck;

/**
 * Created by David on 2016/4/30.
 */
public class Duck implements Comparable<Duck> {
    private String name;
    private int weight;

    public Duck(String name, int weight) {
        this.name = name;
        this.weight = weight;
    }

    @Override
    public String toString() {
        return String.format("[%s, %d]", name, weight);
    }

    @Override
    public int compareTo(Duck o) {
        return this.weight - o.weight;
    }
}
